/////////////////////////////////////////////
/// Tell me more about *
/////////////////////////////////////////////
sparqlresult=""
//context.sendMessageToUser("ok, I'll try find out this.")

//now = new java.text.SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").format(new Date())
//context.sendMessageToUser(now)

// fetching the log
log = context.getLog()

// the wildcards
wildcard1 = match.wildcard(bitoflife.chatterbean.Match.Section.PATTERN,1).trim();

// query for member names
memberQuery = "SELECT DISTINCT ?name FROM <http://xmlns.com/foaf/spec/index.rdf> WHERE {"+
	"?s ?p1 ?subjectpattern. ?s <http://xmlns.com/foaf/0.1/member> ?person. ?person <http://xmlns.com/foaf/0.1/name> ?name."+
	"FILTER regex(?subjectpattern, '.*"+wildcard1+".*', 'i').}"
log.info(memberQuery)
//context.sendMessageToUser(documentQuery)

counter = 0;
members = context.queryForTable(memberQuery,null,null)
members.each(){
	res = it
	counter = counter + res.getResultCount()
	if (res.getResultCount() > 0) context.sendMessageToUser("From " + res.getStoreName() + ":")
	log.info(res.getResultCount())
	res.getResultRows().each(){ 
		log.info(it["name"])
		context.sendMessageToUser(" * "+it["name"])
	}
}
if(counter == 0) context.sendMessageToUser("Sorry, I can't answer your question.")

